import QtQuick 2.7
import QtGraphicalEffects 1.0
import Quick.UIComponent.Text.Normal 0.1


Rectangle {
    id:root
    color: "#00000000"

    signal clicked

    clip: true
    property alias _radius: root.radius
    property alias source: icon.source
    property alias _iconWidth: icon.width
    property alias describe: name.text
    property color startColor:"#243949"
    property color endColor:"#517fa4"

    LinearGradient{
        id:gradient
        anchors.fill: parent
        gradient: Gradient {
          GradientStop { position: 0.0; color: startColor }
          GradientStop { position: 1.0; color: endColor }
        }
    }

    Image{
        id:icon
        height: width
        anchors{
            left: parent.left
            leftMargin: 20
            verticalCenter: parent.verticalCenter
        }
    }

    MText{
        id:name
        pxSize: 24
        anchors{
            right: parent.right
            rightMargin: 20
            verticalCenter: parent.verticalCenter
        }
    }


    MouseArea {
        id: mouseArea
        anchors.fill: parent
//        cursorShape: (root.state != "normal")?  Qt.PointingHandCursor:
//                                   Qt.ArrowCursor
        hoverEnabled:true
        onClicked: {
            emit:root.clicked()
        }
        onEntered: {

        }
        onExited: {

        }
        onPressed: {
            gradient.opacity = 0.4
        }
        onReleased: {
            gradient.opacity = 1
//            if(mouse.containsMouse){
//                gradient.opacity = 1
//            }
        }
    }




}
